<?php (defined('BASEPATH')) OR exit('No direct script access allowed');

/* load the MX_Loader class */

class MY_Loader extends CI_Loader {
	var $ci;
	public function __construct(){
		parent::__construct();
		$this->ci = & get_instance();
		
	}

	function dynamic_sidebar($index = 1){
	add_action('widgets','widget');
	$widgets_activate = array('helloworld2' =>array('title'=>'xx'), 'helloworld3' =>array('title'=>'xx'));

	//get all sidebars
	$sidebars_widgets = array(
			'sidebar-1' => array('recent-comments'),
			'right-1' => array(
				'helloworld2',
				'helloworld3',
				),
			'footer-1' => array(
				'helloworld3',
				),
			);
	$sidebars_widgets = array();
	if (empty( $sidebars_widgets[ $index ] ) || ! is_array( $sidebars_widgets[ $index ])) {
		return false;
	}
	
	foreach ( (array) $sidebars_widgets[$index] as $id) {
		if (!isset($widgets_activate[$id])) continue;
			do_action('widgets',$id,$widgets_activate[$id]);
		}
	
	}
	
}

